//
// Created by zhou on 2021/10/31.
//
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
    vector<vector<int>> generate(int numRows) {

        vector<vector<int>> result(numRows);
        vector<int >dp1={1};
        result[0]=dp1;
        if(numRows==1)return result;
        vector<int >dp2={1,1};
        result[1]=dp2;
        if(numRows==2)return result;
        for(int i=2;i<numRows;i++){
            result[i].resize(i+1);

            result[i][0]=1;
            result[i][i]=1;
            for(int j=1;j<i;j++){
                result[i][j]=result[i-1][j-1]+result[i-1][j];
            }
        }
        return result;
    }
};
int main(){
    Solution solution;
    vector<vector<int>> m=solution.generate(10);
    for(auto x:m){
        for(auto y:x){
            cout<<y<<",";
        }
    }
}